package com.gpay.erp.services.system.impl;

import java.util.List;
import javax.annotation.Resource;
import com.gpay.erp.core.dao.BaseDao;
import com.gpay.erp.core.dao.page.PagerModel;
import com.gpay.erp.core.system.bean.Suppliers;
import com.gpay.erp.services.system.SuppliersInteface;
import org.springframework.stereotype.Service;

/**
 * 用户业务逻辑实现类
 * 
 * @author comrose
 * 
 */
@Service
public class SuppliersService implements SuppliersInteface {
	@Resource
	private BaseDao dao;

	public void setDao(BaseDao dao) {
		this.dao = dao;
	}

	public int insert(PagerModel e) {
		return dao.insert("suppliers.addsuppliers", e);
	}

	public int delete(PagerModel e) {
		return 0;
	}

	public int deletes(String[] ids) {
		int length = 0;
		for (String id : ids) {
			/* int flag=dao.delete("suppliers.deleteById", id); */
			int flag = dao.delete("suppliers.updateBysuppliers", id);
			length = flag + length;
		}
		if (length == ids.length) {
			return 1;
		}
		return 0;
	}

	public int update(PagerModel e) {
		return dao.update("suppliers.updatesuppliers", e);
	}

	public PagerModel selectOne(PagerModel e) {
		return null;
	}

	public PagerModel selectById(String id) {
		return (PagerModel) dao.selectOne("suppliers.selectOneNew", id);
	}

	public PagerModel selectPageList(PagerModel e) {
		return dao.selectPageList("suppliers.selectPageList",
				"suppliers.dataTotal", e);
	}

	public List selectList(PagerModel e) {
		return dao.selectList("suppliers.selectSuppliersAll");
	}

}
